package controller;

import agents.intelligence.AgentAttributes;
import agents.intelligence.IndividualProfile;
import view.panels.MapPanel;
import model.Model;

public class Controller {

	private Model model;
	
	public Controller(Model model) {
		
		this.model = model;
	}

	public Model getModel() {
		
		return model;
	}	
	
	public MapPanel getMapPanel() {
		
		return model.getMapPanel();
	}
	
	public void setMap(MapPanel map) {
		
		model.setMapPanel(map);
	}
	
	public void setModel(Model model) {
		
		this.model = model;
	}
	
	public void buildImage() {
	
		model.getMapImageBuilder().buildImage();
	}
	
	public void getData() {
	
		model.getModelMapBuilder().configureModelMap();
		model.getModelMapBuilder().getOpenStreetMapInfo();
		model.buildRoadsDrivers();
	}
	
	public void startSimulation() {
		
		model.startSimulation();
	}
	
	public void clearData() {
		
		model.getMapImageBuilder().clearData();
	}

	public void configureAgents(Integer type, Integer number, 
			IndividualProfile profile,Integer action) {
		
		model.getIndividualsBuilder().configureAgents(type,number,action);
	}
	
	public void generateTraffic() {
		
		model.generateTraffic();
	}

	public void eraseType(Integer posicion) {
	
		model.getIndividualsBuilder().eraseType(posicion);
	}
	
	public void cleanTypeList() {
		
		model.getIndividualsBuilder().cleanTypeList();
	}

	public void updateTable() {
		
		model.getIndividualsBuilder().updateTable();
	}
	
	public void updateWithoutContent(Integer value) {
		
		model.updateWithoutContent(value);
	}

	public AgentAttributes consultElement(Integer position) {
	
		return model.getIndividualsBuilder().consultElement(position);
	}

	public void updateAgents(IndividualProfile info, Integer position) {
		
		model.getIndividualsBuilder().updateAgents(info,position);
	}

	public void setStopSimulation(Boolean stop) {
		
		model.setStopSimulation(stop);
		model.stopAll();
	}

	public void calculateStadistics() {
	
		model.getEstadistics();
	}

	public void configureEnvironment(Integer tipoEntorno, Integer condiciones) {
	
		model.configureEnvironment(tipoEntorno,condiciones);
	}

	public void setSimulationSpeed(int value) {
		
		model.setSimulationSpeed(value);
	}

	public void resetSpeedSimulation() {
		
		model.resetSpeedSimulation();
	}
}
